<?php if( ! defined('BASEPATH')) exit('No direct script access allowed');

class Agent_model extends CI_Model
{
	public function delete_agent($id)
	{
		return $this->db->delete('users', array('id' => $id));
	}
	
	function view()
	{		
	   $this->datatables
			->select("id,first_name,last_name,company,email,phone,address")
			->from("users")
			
			->add_column("Actions", 
			"<center>			<a href='index.php/admin/agent/edit_agent/$1'>
			
								<i class='icon-edit'></i>
								</a>
							    <a href='index.php/admin/agent/delete_agent/$1' onClick=\"return confirm('". $this->lang->line('alert_x_customer') ."')\">
								<i class='icon-trash'></i>
								</a></center>", "id")
			->unset_column('id');
			
	   return  $this->datatables->generate();
			
	}
}